from __future__ import print_function

import logging

import grpc
import test_pb2
import test_pb2_grpc


def run():
    with grpc.insecure_channel('localhost:10086') as channel:
        client = test_pb2_grpc.UserInfoStub(channel)  # 客户端使用Stub类发送请求，参数为频道，为了绑定链接
        response = client.Info(test_pb2.request(name='张三', age=2))
        print("用户信息： " + response.message)


if __name__ == '__main__':
    logging.basicConfig()
    run()

